<%@page import="auxilary.Links"%>
<%@page import="entities.Course"%>
<%@page import="java.util.List"%>
<%@page import="auxilary.Actions"%>
<%@page import="entities.User"%>
<%@ page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<%
	User pageUser = (User)request.getAttribute("user");
	List<Course> courses = (List<Course>)request.getAttribute("courses"); 
	List<Course> wishList = (List<Course>)request.getAttribute("wishList");
%>
<jsp:include page="/frames/start.jsp" />
	<%=Links.Css.PROFILE %>
	<%=Links.Css.COURSE %>
	<%=Links.Css.USER %>
	<%=Links.Scripts.PROFILE %>
<jsp:include page="/frames/frame.jsp" />
			<div class="tops">
				<a class="top" href ="<%=Links.Pages.USERS_BASE %>">See all users</a>
			</div>
			<h1><%=pageUser.getUsername() %>'s Info</h1>
			<h2>Profile Info</h2>
			<table>
				<tr>
					<th class="username">Username</th>
					<th class="name">Name</th>
					<th class="email">E-mail</th>
					<th class="faculty">Faculty</th>
					<th class="semester">S</th>
					<th class="phone">Phone</th>
				</tr>
				<tr>
					<td class="username"><%=pageUser.getUsername() %></td>
					<td class="name"><%=pageUser.getFirstName() %> <%=pageUser.getLastName() %></td>
					<td class="email"><%=pageUser.getEmail() %></td>
					<td class="faculty"><%=pageUser.getFaculty() %></td>
					<td class="semester"><%=pageUser.getSemester() %></td>
					<td class="phone"><%=pageUser.getPhone() %></td>
				</tr>
			</table>
			<br />
			<h2><%=pageUser.getUsername() %>'s Registered Courses</h2>
		   <% if (courses.isEmpty()) { %>
		    <center><h4><%=pageUser.getUsername() %> is not registered to any courses</h4></center>
		   <% } else {%>
			<table>
				<tr>
					<th class="course-name">Name</th>
					<th class="course-points">Points</th>
					<th class="course-availabel">Spots</th>
					<th></th>
				</tr>
			   <% for (Course course : courses) { %>
				<tr id="">
					<td class="course-name"><%=course.getName() %></td>
					<td class="course-points"><%=course.getCredits() %></td>
					<td class="course-points">10/<%=course.getCapacity() %></td>
					<td class="course-view" onclick="window.location.href='<%=Links.Pages.COURSES_BASE %><%=course.getId() %>';">view</td>
			   <% } %>
			</table>
		   <% } %>
		    <h2><%=pageUser.getUsername() %>'s WishList</h2>
		   <% if (wishList.isEmpty()) { %>
		    <center><h4><%=pageUser.getUsername() %> has no courses in his wishlist</h4></center>
		   <% } else {%>
			<table>
				<tr>
					<th class="course-name">Name</th>
					<th class="course-points">Points</th>
					<th class="course-availabel">Spots</th>
					<th></th>
				</tr>
			   <% for (Course course : wishList) { %>
				<tr id="">
					<td class="course-name"><%=course.getName() %></td>
					<td class="course-points"><%=course.getCredits() %></td>
					<td class="course-points">10/<%=course.getCapacity() %></td>
					<td class="course-view" onclick="window.location.href='<%=Links.Pages.COURSES_BASE %><%=course.getId() %>';">view</td>
				</tr>
			   <% } %>
			</table>
		   <% } %>
<jsp:include page="/frames/end.jsp" />